package com.seal.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.seal.comm.utils.Page;
import com.seal.dao.IRegUserinfoDao;
import com.seal.dto.RegUserinfoDto;
import com.seal.model.RegUserinfo;
import com.seal.service.IRegUserinfoService;

@Service("regUserinfoServiceImpl")
@Transactional(readOnly = false)
public class RegUserinfoServiceImpl implements IRegUserinfoService {

	@Resource(name = "regUserinfoDaoImpl")
	private IRegUserinfoDao regUserinfoDao;

	@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = Exception.class)
	public void addRegUserinfo(RegUserinfo ca) throws Exception{
		regUserinfoDao.addRegUserinfo(ca);
	}

	public RegUserinfo getRegUserinfoByUserId(String userId)
			throws Exception {
		return regUserinfoDao.getRegUserinfoByUserId(userId);
	}

	@Transactional(propagation = Propagation.REQUIRED,readOnly = false, rollbackForClassName = "Exception")
	public void updateRegUserinfo(RegUserinfo ca) throws Exception {
		regUserinfoDao.updateRegUserinfo(ca);
	}

	public boolean checkEmailExists(String userId,String email) throws Exception {
		return regUserinfoDao.checkEmailExists(userId,email);
	}

	public List<RegUserinfo> getAllRegUserinfo(RegUserinfoDto dto, Page page)throws Exception{
		return regUserinfoDao.getAllRegUserinfo(dto, page);
	}

	public RegUserinfo getRegUserinfoByEmail(String email) throws Exception {
		return regUserinfoDao.getRegUserinfoByEmail(email);
	}
}
